
import api from './fetch/api.js'

const actions = {
  /**
   * 获取登录信息actions
   * @param {*} params username password type 1学生 2教职工
   */
    userlogin({commit, state}, params) {
        console.log('进入获取登录信息actions')
        return new Promise((resolve, reject) => {
            api.minePostMsgApi(state.TFhost + '/itfer/rest/user/login', params)
                .then(res => {
                    resolve(res)
                })
        })
    },
    /**
     * API/插入用户数据
     * @param {*} param0
     * @param {*} params 用户信息
     */
    async saveUserInfo({commit, state}, params) {
        return await api.minePostMsgApi(state.Host + '/itfer-qkfy/rest/user/saveUserInfo', params)
    },
    /**
     *获取全校一级单位
     */
    async getAllDept({commit, state}, params) {
        return await api.mineBaseMsgApi(state.TFhost + '/itfer/rest/employee/getAllDept')
    },
    /**
     *根据单位号获取部门同事
     */
    async getColleaguesByDwh({commit, state}, params) {
        return await api.mineBaseMsgApi(state.TFhost + '/itfer/rest/school/getColleaguesByDwh/' + params.DWH)
    }
}

export default actions
